#!/bin/bash
###SHELLPACK preamble libmicro-socket-bench 1

###SHELLPACK parseargBegin
###SHELLPACK parseargInstall
###SHELLPACK parseargEnd
###SHELLPACK monitor_hooks

###SHELLPACK check_install_required libmicro-socket-${VERSION}
###SHELLPACK init_complete

cd $SHELLPACK_SOURCES/libmicro-socket-${VERSION}-installed || die "Failed to cd to libmicro directory"

COMMON="-E -C 0 -D 30000 -B 10000 -L -S -W"

while read A B C; do
	monitor_pre_hook $LOGDIR_RESULTS $A-$B
	if [ -f bin/$A ]; then
		eval bin/$A $COMMON -N "$B" $C 2>&1 > $LOGDIR_RESULTS/$B.log
	fi
	monitor_post_hook $LOGDIR_RESULTS $A-$B
done <<EOT
getsockname	getsockname
getpeername	getpeername
socket	socket_u
socket	socket_i	-f PF_INET
socketpair	socketpair
setsockopt	setsockopt
bind	bind
listen	listen
poll	poll_10	-n 10
poll	poll_100	-n 100
poll	poll_w10	-n 10	-w 1
poll	poll_w100	-n 100	-w 10
select	select_10	-n 10
select	select_100	-n 100
select	select_w10	-n 10	-w 1
select	select_w100	-n 100	-w 10
EOT

exit $SHELLPACK_SUCCESS
